@zipter98 paresce q agora configurei certo mas por algum erro ele ta falando q nao achou os items
[05/12/2016 20:20:00] [Error - Action Interface]
[05/12/2016 20:20:00] In a timer event called from:
[05/12/2016 20:20:00] data/actions/scripts/ProfessionAction.lua:onUse
[05/12/2016 20:20:00] Description:
[05/12/2016 20:20:00] (luaDoTransformItem) Item not found

-- Sistema de profissão
-- Desenvolvido por Gabriel Lucena (Drazyn1291/BielLucena1291) e GOD Vitor.
-- Geral
ProfessionLib = {
geral_sto = 123123, -- Não mecha
OutfitTime = 8, -- Tempo em que dura a outfit
NeedVip = true, -- Se precisa de vip para mudar/virar a profissão
CostToChange = 125, -- Quantidade do itemid abaixo que vai ser usado para mudar de profissão
itemid = 2160, -- Item que vai ser usado para mudar de profissão
quantMax = 3, -- Quantidade máxima
}
ProfessionId = {
--[4] = {name = Proffision Name, looktypeM = LookType male (Coletando item), looktypeF = LookType Female, CollectItemId = Item que coleta (Ex: Machado do stylist), CollectItem = Item Que é coletado (Madeira do stylist), targetItem = {target = Item Alvo (Arvore do Stylist), newid = Item que é transformado depois de cortado}},
[1] = {name = "Stylist", looktypeM = 2387, looktypeF = 2388, CollectItemId = 2553, CollectItem = 5901, targetItem = {target = 2711, newid = {17207, 17208, 17209, 17210, 17211, 17212}}},
[2] = {name = "Engineer", looktypeM = 2091, looktypeF = 2092, CollectItemId = 13327, CollectItem = 8309, targetItem = {target = 1480, newid = 7660}},
[3] = {name = "Adventurer", looktypeM = 2264, looktypeF = 2265, CollectItemId = 11454, CollectItem = 13075, targetItem = {target = 2706, newid = 2741}},
[4] = {name = "Teacher", looktypeM = 2260, looktypeF = 2261, CollectItemId = 11455, CollectItem = 13075, targetItem = {target = 2706, newid = 2741}},
}
-- NPC de troca
SellStylist = {
--{id = ID, toDo = {{id, quant}, {id, quant}}}
[1] = {id = 7866, quant = 1, level = 50, toDo = {{2666, 45}, {5901, 475}}},
[2] = {id = 7868, quant = 1, level = 80, toDo = {{12148, 15}, {5901, 580}}},
}
SellEnginner = {
--{id = ID, toDo = {{id, quant}, {id, quant}}}
[1] = {id = 2174, quant = 100, level = 10, toDo = {{2177, 10}, {2160, 2}}},
[2] = {id = 2175, quant = 10, level = 10, toDo = {{2179, 2}, {2160, 3}}},
}
SellAdventurer = {
--{id = ID, toDo = {{id, quant}, {id, quant}}}
[1] = {id = 2174, quant = 100, level = 10, toDo = {{2177, 10}, {2160, 2}}},
[2] = {id = 2175, quant = 10, level = 10, toDo = {{2179, 2}, {2160, 3}}},
}
SellTeacher = {
--{id = ID, toDo = {{id, quant}, {id, quant}}}
[1] = {id = 2174, quant = 100, level = 10, toDo = {{2177, 10}, {2160, 2}}},
[2] = {id = 2175, quant = 10, level = 10, toDo = {{2179, 2}, {2160, 3}}},
}
-- Functions
function canEnterInProfession(cid)
if ProfessionLib.NeedVip and not isPremium(cid) then
return false
end
return true
end
function existProfession(profName)
cont = false
for i = 1, #ProfessionId do
if not cont then
if ProfessionId.name == profName then
cont = true
end
end
end
return cont
end
function hasProfession(cid)
if ProfessionId[getPlayerProfessionId(cid)] then
return true
end
return false
end
function existProfession(profName)
cont = false
for i = 1, #ProfessionId do
if not cont then
if ProfessionId.name == profName then
cont = true
end
end
end
return cont
end
function getProfessionIdByName(profName)
for i = 1, #ProfessionId do
if ProfessionId.name == profName then
return i
end
end
end
function doChangeProfession(cid, id, check)
if ProfessionLib.NeedVip and not isPremium(cid) then
return false
end
if check then
if hasProfession(cid) then
return false
else
if ProfessionId[id] or id == 0 then
setPlayerStorageValue(cid, ProfessionLib.geral_sto, id)
doPlayerAddItem(cid, ProfessionId[id].CollectItemId, 1)
else
return false
end
end
else
if ProfessionId[id] or id == 0 then
setPlayerStorageValue(cid, ProfessionLib.geral_sto, id)
doPlayerAddItem(cid, ProfessionId[id].CollectItemId, 1)
else
return false
end
end
end
function getPlayerProfessionId(cid)
return getPlayerStorageValue(cid, ProfessionLib.geral_sto)
end
function getProfessionName(cid)
if hasProfession(cid) then
return ProfessionId[getPlayerProfessionId(cid)].name
end
return ""
end
function doReturnItemsWithDelay(toPosition, itemid, times)
local function doReturnItem(itemposition,oldid)
local pos = getThingfromPos(itemposition)
doTransformItem(pos.uid,oldid)
doSetItemText(pos.uid, getItemNameById(oldid))
end
addEvent(doReturnItem, times * 1000,toPosition, itemid)
end
function doConcatTable(itemsss, sep1, sep2)
str = ""
if #itemsss > 0 then
for i = 1, #itemsss do
if #itemsss > 1 then
if i ~= #itemsss then
if i ~= 1 then
str = str..sep1..itemsss
else
str = str..itemsss
end
else
str = str..sep2..itemsss
end
else
str = itemsss
end
end
end
return str
end
-- Sistema de profissão
-- Desenvolvido por Gabriel Lucena (Drazyn1291/BielLucena1291)
--Tag: <action itemid="ITEMID;ITEMID;ITEMID;ITEMID" event="script" value="ProfessionAction.lua"/>-
function onUse(cid, item, fromPosition, itemEx, item2, toPosition)
if not isCreature(itemEx.uid) then
if not (getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 17001) >= 1) then
if ProfessionId[getPlayerProfessionId(cid)] then
cont = false
name = ""
for i = 1, #ProfessionId do
if item.itemid == ProfessionId.CollectItemId and i == getPlayerProfessionId(cid) then
cont = true
else
if item.itemid == ProfessionId.CollectItemId then
name = ProfessionId.name
end
end
end
if cont then
if ProfessionId[getPlayerProfessionId(cid)].targetItem.target == itemEx.itemid then
toPos = getThingPosition(itemEx.uid)
fromPos = getCreaturePosition(cid)
if getDistanceBetween(fromPos, toPos) <= 1 then
if getDirectionTo(fromPos, toPos) == getCreatureLookDirection(cid) then
quantItem = math.random(1, ProfessionLib.quantMax)
doCreatureSetNoMove(cid, true)
if getPlayerSex(cid) == 1 then
lp = ProfessionId[getPlayerProfessionId(cid)].looktypeM
else
lp = ProfessionId[getPlayerProfessionId(cid)].looktypeF
end
doSetCreatureOutfit(cid, {lookType = lp, lookHead = getCreatureOutfit(cid).lookHead, lookBody = getCreatureOutfit(cid).lookBody, lookLegs = getCreatureOutfit(cid).lookLegs, lookFeet = getCreatureOutfit(cid).lookFeet}, -1) -- getCreatureLookDirection(cid)
local ids = ProfessionId[getPlayerProfessionId(cid)].targetItem.newid
for i = 1, #ids do
addEvent(doTransformItem, i * 100, getThingFromPos(toPos).uid, ids)
end
addEvent(function()
doRemoveCondition(cid, CONDITION_OUTFIT)
doCreatureSetNoMove(cid, false)
doReturnItemsWithDelay(toPos, ProfessionId[getPlayerProfessionId(cid)].targetItem.target, 60)
doPlayerAddItem(cid, ProfessionId[getPlayerProfessionId(cid)].CollectItem, quantItem)
doPlayerSendTextMessage(cid, 27, "Você recebeu "..quantItem.."x "..getItemNameById(ProfessionId[getPlayerProfessionId(cid)].CollectItem).." por fazer essa ação!")
end, ProfessionLib.OutfitTime*1000)
else
doPlayerSendCancel(cid, "Você percisa ficar de frente para esse item!")
end
else
doPlayerSendCancel(cid, "Você precisa está na frente do item!")
end
else
doPlayerSendCancel(cid, "Você não pode usar esse item aqui!")
end
else
doPlayerSendCancel(cid, "Você precisa ser "..name.." para usar esse item!")
end
else
doPlayerSendCancel(cid, "Você não tem nenhuma profissão!")
end
else
doPlayerSendCancel(cid, "Você não pode usar esse item enquanto estiver montado!")
end
else
doPlayerSendCancel(cid, "Você não pode usar esse item aqui!")
end
return true
end









info
Grupo: Herói
Registrado: 20/09/12
Posts: 2.6k
Reputação: +1.1k
Gênero: Masculino
Como não programo há tempos, foi mesmo bom eu ter resolvido testar o código.
Primeiramente, aqui está o código corrigido do wougoplex:
local ids = {19225, 19226, 19227, 19228, 19229, 19230, 19231, 19232}function onUse(cid, item, fromPosition, itemEx, toPosition) local old_id = item.itemid for i = 1, #ids do addEvent(function() local _item = getTileItemById(toPosition, old_id).uid if _item > 0 then doTransformItem(_item, ids[i]) old_id = ids[i] end end, i * 100) --Aqui você ajusta o intervalo de tempo entre as transformações. A unidade de tempo é milissegundos. end return trueendJosegvb, você errou na configuração da tabela.
Troque:
targetItem = {target = 2711, newid = 17207, 17208, 17209, 17210, 17211,17212}por:
targetItem = {target = 2711, newid = {17207, 17208, 17209, 17210, 17211, 17212}}Troque, também:
addEvent(doTransformItem, i * 100, getThingFromPos(toPos).uid, ids)por:
addEvent(doTransformItem, i * 100, getThingFromPos(toPos).uid, ids[i])Para que as transformações ocorram durante a ação, transfira essas linhas:
local ids = ProfessionId[getPlayerProfessionId(cid)].targetItem.newidfor i = 1, #ids do addEvent(doTransformItem, i * 100, getThingFromPos(toPos).uid, ids[i])endpara antes do:
addEvent(function()Editado Dezembro 5 por zipter98